﻿using System;
using Com.PhilChuang.Utils;

namespace Com.PhilChuang.Pmvp.Ui.Views.Impl.ViewModels
{
	public class AboutPageViewModel : AbstractViewModel
	{
		#region Bindable Properties
		private VersionInfo myVersionInfo;
		public VersionInfo VersionInfo
		{
			get { return myVersionInfo; }
			set
			{
				myVersionInfo = value;
				RaisePropertyChanged (() => VersionInfo);
				RaisePropertyChanged (() => AppName);
				RaisePropertyChanged (() => AppVersionString);
				RaisePropertyChanged (() => VersionInfoDate);
				RaisePropertyChanged (() => RateAppText);
				RaisePropertyChanged (() => RateAppButtonText);
				RaisePropertyChanged (() => SendFeedbackText);
			}
		}

		public String AppName
		{ get { return VersionInfo != null ? VersionInfo.ProductName : String.Empty; } }

		public String VersionInfoDate
		{
			get
			{
				return myVersionInfo == null
						? String.Empty
						: myVersionInfo.VersionDate.ToShortDateString ();
			}
		}

		public string AppVersionString
		{ get { return myVersionInfo.ToStringOr ("N/A"); } }

		private String myHelpContent;
		public String HelpContent
		{
			get { return myHelpContent; }
			set
			{
				myHelpContent = value;
				RaisePropertyChanged (() => HelpContent);
			}
		}

		//private bool myShowDonateLink;
		//public bool ShowDonateLink
		//{
		//    get { return myShowDonateLink; }
		//    set
		//    {
		//        myShowDonateLink = value;
		//        RaisePropertyChanged (() => ShowDonateLink);
		//    }
		//}

		public String RateAppText
		{
			get { return "If you've found {0} to be useful, please take a moment to rate it!   I appreciate your reviews.".FormatWith (AppName); }
		}

		public String RateAppButtonText
		{
			get { return "Rate {0}".FormatWith (AppName); }
		}

		public String SendFeedbackText
		{
			get { return "Please let me know how {0} can be improved!.".FormatWith (AppName); }
		}
		#endregion

		#region Constructors
		//public AboutPageViewModel ()
		//{
		//}
		#endregion

		#region Functionality (EMPTY)
		#endregion

		#region Utility methods (EMPTY)
		#endregion
	}
}
